package com.xy.annotaion.handler.kotlin.compiler.demo1

open class ASTLeaf(t: Token) : ASTree() {
    companion object {
        val empty = mutableListOf<ASTree>()
    }

    protected val token = t
    override fun location() = "at line " + token.getLineNumber()
    override fun child(i: Int): ASTree {
        throw IndexOutOfBoundsException()
    }

    override fun numChildren() = 0
    override fun children() = empty.iterator()
    override fun toString() = token.getText()

    fun token() = token

}
